package net.ericaro.neojavagengen;

import net.ericaro.neojavagen.Literals;
import net.ericaro.neojavagen.names.QualifiedIdentifier;
import net.ericaro.neojavagen.packages.CompilationUnit;
import net.ericaro.neojavagen.types.ClassOrInterfaceType;
import net.ericaro.neojavagen.types.Identifier;
import net.ericaro.neojavagen.types.InterfaceType;
import net.ericaro.neojavagen.types.TypeArguments;
import net.ericaro.neojavagen.types.TypedIdentifier;

public class EnumSetPart implements Part{
	private PartReference target;
	private PartReference self;
	private Identifier simpleTypeName;
	private TypedIdentifier nameIdentifier;
	
	public EnumSetPart(Grammar grammar, String name, String referencedType) {
		this.self = grammar.createPartReference(name);
		self.attach(this);
		simpleTypeName = Literals.identifier("EnumSet");
		this.target = grammar.createPartReference(referencedType);
	}

	
	
	public void resolve() {
		
		nameIdentifier = new TypedIdentifier(simpleTypeName, new TypeArguments(target.getClassOrInterfaceType()));
	}
	public ClassOrInterfaceType getClassOrInterfaceType() {
		ClassOrInterfaceType typedIdentifiers = new ClassOrInterfaceType();
		for (Identifier i : getQualifiedPackageName())
			typedIdentifiers.add(new TypedIdentifier(i));
		typedIdentifiers.add(nameIdentifier);
		return typedIdentifiers;
	}


	public Identifier getSimpleTypeName() {
		return simpleTypeName;
	}




	public QualifiedIdentifier getQualifiedPackageName() {
		return new QualifiedIdentifier(Literals.identifier("java"),Literals.identifier("util"));
	}



	public CompilationUnit getCompilationUnit() {
		return null;
	}



	public void addInterfaceType(InterfaceType classOrInterfaceType) {
		// does not apply
	}

	
	
	
}
